package com.springbatch.springbatch.filetodb;

import com.springbatch.springbatch.bo.Person;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ItemProcessor implements org.springframework.batch.item.ItemProcessor<Person, Person> {
    private static final Logger log = LoggerFactory.getLogger(ItemProcessor.class);

    @Override
    public Person process(final Person person) throws Exception {
        final String firstName = person.getFirstName().toUpperCase();
        final String lastName = person.getLastName().toUpperCase();
        final String id = person.getId();
        final Person transformedPerson = new Person(id, firstName, lastName);

        log.info("Converting (" + person + ") into (" + transformedPerson + ")");

        return transformedPerson;
    }

}
